'''
Description: 
Author: Zilu
Date: 2021-11-07 17:17:18
Version: 
LastEditTime: 2021-11-07 17:34:04
LastEditors: Zilu
'''

# 多重继承，同一个子类可以继承多个父类的方法
from _typeshed import FileDescriptorLike


class Animal(object):
    pass

class Mammal(Animal):
    pass

class Bird(Animal):
    pass

class Runnable(Animal):
    def run(self):
        print('Running...')

class Flyable(Animal):
    def fly(self):
        print('Flying...')

class Dog(Mammal, Runnable):
    pass

class Bat(Mammal, Flyable):
    pass

# python 自带的很多库也使用了MixIn设计的方法，
# 如TCPServer、UDPServer两类服务，可以结合ForkingMixIn、ThreadingMixIn
# 创建用户需要的多进程/多线程服务模型
# 多进程的TCP服务模型：
from socketserver import TCPServer, UDPServer, ThreadingMixIn
class MyTCPServer(TCPServer, ThreadingMixIn):
    pass

# 多线程的UDP服务模型：
class MyUDPServer(UDPServer, ThreadingMixIn):
    pass


